using System;
using System.Collections.Generic;
using System.Text;

namespace SharpMud.MudLib.Common.Entities.Players.Session.States
{
    //public class TerminalSessionStateStack<TTerminalType> : ITerminalSessionState<TTerminalType> where TTerminalType : SharpMud.Terminal.IInteractiveTerminal, new()
    //{
    //    private Stack<ITerminalSessionState<TTerminalType>> _States;
    //    private TTerminalType _Session;
    //    private ITerminalSessionState<TTerminalType> _ParentState;

    //    public TerminalSessionStateStack()
    //    {
    //        _States = new Stack<ITerminalSessionState<TTerminalType>>();
    //    }

    //    public TerminalSessionStateStack(ITerminalSessionState<TTerminalType>[] states)
    //        : this()
    //    {
    //        foreach (ITerminalSessionState<TTerminalType> state in states)
    //        {
    //            this.Push(state);
    //        }
    //    }

    //    public ITerminalSessionState<TTerminalType> Peek()
    //    {
    //        return _States.Peek();
    //    }

    //    public ITerminalSessionState<TTerminalType> Pop()
    //    {
    //        return _States.Pop();
    //    }

    //    public void Push(ITerminalSessionState<TTerminalType> state)
    //    {
    //        state.Initialize(this, _Session);
    //        _States.Push(state);
    //    }

    //    public TTerminalType Session
    //    {
    //        get
    //        {
    //            return _Session;
    //        }
    //    }

    //    #region ITerminalSessionState<TTerminalType> Members

    //    public void Initialize(TTerminalType session)
    //    {
    //        this._Session = session;
    //    }

    //    public void Initialize(ITerminalSessionState<TTerminalType> parentState, TTerminalType session)
    //    {
    //        _ParentState = parentState;
    //        _Session = session;
    //    }

    //    public ITerminalSessionState<TTerminalType> ParentState
    //    {
    //        get { return _ParentState; }
    //    }

    //    public string StateID
    //    {
    //        get { if (_States.Count == 0) return ""; else return _States.Peek().StateID; }
    //    }

    //    public bool StillActive
    //    {
    //        get { if (_States.Count == 0) return false; else return true; }
    //    }

    //    #endregion

    //    #region IRequiresExternalPulsing Members

    //    public void Pulse()
    //    {
    //        if (_States.Count > 0)
    //        {
    //            _States.Peek().Pulse();
    //            if (!_States.Peek().StillActive)
    //            {
    //                _States.Pop();
    //            }
    //        }
    //    }

    //    #endregion
    //}
}
